package xyz.lilei123.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @author jack
 * @version 1.0
 * @date 25/01/2022 15:00
 **/
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    private ApiInfo apiInfo() {
        Contact contact = new Contact("jack", "https://gitee.com/lilei123xyz/mq-case", "l1372254416@gamil.com");
        return new ApiInfo("rabbit-demo",
                "",
                "1.0",
                "https://gitee.com/lilei123xyz/mq-case",
                contact,
                "Apache 2.0",
                "https://gitee.com/lilei123xyz/mq-case",
                new ArrayList<>()
        );
    }

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("es")
                .enable(true)
                .select()
                .apis(RequestHandlerSelectors.any())
                .build();
    }
}
